package com.ww.springboot.boot.thread.study.executor.taskExecutor;

import org.springframework.core.task.SimpleAsyncTaskExecutor;
import org.springframework.core.task.TaskExecutor;

/**
 * 描述：
 *
 * @author 🧑 ‍wanwei
 * @since 2022-06-27 17:31
 */
public class TaskExecutorDemo {

    public static void main(String[] args) {
        TaskExecutor taskExecutor = new SimpleAsyncTaskExecutor();


        for (int i = 0; i < 100000; i++) {
            try {
                Thread.sleep(1);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            taskExecutor.execute(() -> {
                for (int j = 0; j < 10; j++) {
                    System.out.println(Thread.currentThread());
                    try {
                        Thread.sleep(100);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            });
        }

    }
}
